<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html	xmlns="http://www.w3.org/1999/xhtml">
<%@ page isELIgnored="false"%>
<%@ page import="nc.vo.sm.UserVO"%>
<%@ page import="nc.bs.ebvp.login.Constant"%>
<%@ page import="nc.bs.ebvp.sourcingcoll.Constants"%>
<%@ page import="nc.bs.ebvppub.ebvpservicefactory.LoadConfigProperty"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
	String path = request.getContextPath();
	String strSessionId = request.getSession().getId();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/" ;
	String strParaEc021 = (String)request.getSession().getAttribute(Constants.ID_EC021);
	UserVO userVo = (UserVO)request.getSession().getAttribute(Constant.USER_INFO);
	boolean isClientCa = false;
	if(userVo!=null){
		//供应商客户端是否支持CA
		if ("Y".equals(strParaEc021) || "y".equals(strParaEc021) || (null != userVo.getIsca() && userVo.getIsca().booleanValue())) {
			isClientCa = true;
		}
	}else{
		isClientCa = false;
	}
	//CA厂商名称
	String strCaFactory = (String)request.getSession().getAttribute(LoadConfigProperty.EBVP_CA_FACTORY);
	//获取服务器IP和端口
	String strServerName = request.getServerName();
	int intServerPort = request.getServerPort();
%>
<head>
<base href="<%=basePath%>"></base>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FileUpload</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<%if(isClientCa){%>
	<%if(Constants.CA_FACTORY_ITRUS.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/itrusforNC.js"></script>
		<script type="text/javascript" src="js/pta.js"></script>
	<%} else if(Constants.CA_FACTORY_INFOSEC.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/Infosec4NC.js"></script>
	<%} else if(Constants.CA_FACTORY_DEAN.equals(strCaFactory)){%>
		<script type="text/javascript" src="js/DatechJs.js"></script>
	<%} %>
<%}%>
<%
	String url = request.getRequestURL().toString();
	String urls[] = url.split("/ebvp/");
	String uploadMode = request.getParameter("uploadMode");
	String userCode = request.getParameter("userCode");
	String pkReleaseFileB = request.getParameter("pkReleaseFileB");
	String isNeedAddRow = request.getParameter("isNeedAddRow");
%>
<script language="javascript">
function refreshParent(){
	<%
		if(null == isNeedAddRow || "n".equalsIgnoreCase(isNeedAddRow)){
	%>
	window.opener.refreshPage();
	<%
		}
	%>
}

function addRow(pkReleaseFileB,replyFileName,replyFileSize,replyFilePath){
	//alert(replyFilePath);
	window.opener.addFileRow(pkReleaseFileB,replyFileName,replyFileSize,replyFilePath);
}

//文件客户端签名
function getSignMsg(filePath){
	filePath = filePath.replace(/\|/g,"\\");
	return SignFile(filePath,"<%=userCode%>");
}
</script>
</head>
 
<body style="width: 610px">
<!--页面头部开始--> 
<center>
<table width="610" cellpadding="7" cellspacing="0" border="0"> 
    <tr>
        <td colspan="2" align="center">
<!-- --------------------------------------------------------------------------------------------------- -->
<!-- --------     A DUMMY APPLET, THAT ALLOWS THE NAVIGATOR TO CHECK THAT JAVA IS INSTALLED   ---------- -->
<!-- --------               If no Java: Java installation is prompted to the user.            ---------- -->
<!-- --------                                                                                 ---------- -->
<!-- --------               THIS IS NOT THE JUpload APPLET TAG !   See below                  ---------- -->
<!-- --------------------------------------------------------------------------------------------------- -->
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->

<!-- "END_CONVERTED_APPLET" -->
<!-- ---------------------------------------------------------------------------------------------------- -->
<!-- --------------------------     END OF THE DUMMY APPLET TAG            ------------------------------ -->
<!-- ---------------------------------------------------------------------------------------------------- -->

<!---------------------------------------------------------------------------------------------------------
-------------------     A SIMPLE AND STANDARD APPLET TAG, to call the JUpload applet  --------------------- 
----------------------------------------------------------------------------------------------------------->
		<OBJECT classid="clsid:CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA" name="JUpload" codebase="http://<%=strServerName%>:<%=intServerPort%>/Client/jre-6u24-windows-i586.exe" style="" width="610" height="300" >
			<param name="java_code" value="nc.ui.ebvp.ebvppub.fileupload.JUploadApplet" />
			<param name="java_archive" value="/ebvp/ebvpupload.jar,/ebvp/jakarta-commons-oro.jar,/ebvp/jakarta-commons-net.jar,/ebvp/httpclient.jar,/ebvp/commons-logging.jar,/ebvp/commons-codec.jar" />
			<param name="type" value="application/x-java-applet;version=1.6" />
			<param name="scriptable" value="true" />
            <param name="uploadURL" value="<%=urls[0]%>/ebvp/ebvpfile/upload" />
            <param name="sessionId" value="<%=strSessionId%>" />
            <!-- Optionnal, see code comments -->
            <param name="showLogWindow" value="false" />
            <param name="showStatusBar" value="true" />
            <param name="debugLevel" value="99" />            
			<param name ="stringUploadSuccess" value="" />
			<param name ="lang" value="zh_CN" />
			<param name ="lookAndFeel" value="java" />
			<param name ="upload_is_ca" value="<%=isClientCa%>" />
			<param name ="upload_ca_func" value="getSignMsg('%filepath%')" />
			<param name ="upload_sn_func" value="getSN('<%=userCode%>')" />
			<param name ="upload_mode" value="<%=uploadMode%>" />
			<param name ="upload_pk_release_file_b" value="<%=pkReleaseFileB%>" />
			<param name ="upload_is_need_add_row" value="<%=isNeedAddRow%>" />
			<param name ="stringUploadError" value="fail" />
			<param name ="afterUploadURL" value="javascript:refreshParent()" />
			<param name ="afterUploadFunc" value="javascript:addRow('%releasefilepk%','%replyfilename%','%replyfilesize%','%replyfilepath%')" />
           	 要求Java 1.5或更高版本插件. 
        </OBJECT>
<!-- --------------------------------------------------------------------------------------------------------
----------------------------------     END OF THE APPLET TAG    ---------------------------------------------
---------------------------------------------------------------------------------------------------------- -->
        </td>
    </tr>   
</table>
</center>
</body>
</html>
